﻿using System;

namespace Net.Formats.oEmbed
{
    /// <summary>
    /// This type is used for rich HTML content that does 
    /// not fall under one of the other categories. 
    /// Responses of this type must obey the maxwidth and maxheight request parameters.
    /// </summary>
    public class RichResponse : GenericResponse
    {
        #region Class Constructor

        public RichResponse( ) : base( ResponseType.Rich ) { }

        #endregion

        #region Private Fields

        string html;
        int? width;
        int? height;

        #endregion

        #region Public Properties

        /// <summary>
        /// The HTML required to display the resource. 
        /// The HTML should have no padding or margins. 
        /// Consumers may wish to load the HTML in an off-domain iframe
        /// to avoid XSS vulnerabilities. 
        /// The markup should be valid XHTML 1.0 Basic.
        /// </summary>
        public string Html
        {
            get
            {
                if ( string.IsNullOrEmpty(html) )
                    throw new ArgumentNullException( "Html is a required property" );
                return html;
            }
            set
            {
                if ( html != value )
                    html = value;
            }
        }

        /// <summary>
        /// The width in pixels required to display the HTML.
        /// </summary>
        public int? Width
        {
            get
            {
                if ( !width.HasValue )
                    throw new ArgumentNullException( "Width is a required property" );
                return width;
            }
            set
            {
                if ( width != value )
                    width = value;
            }
        }

        /// <summary>
        /// The height in pixels required to display the HTML.
        /// </summary>
        public int? Height
        {
            get
            {
                if ( !height.HasValue )
                    throw new ArgumentNullException( "Height is a required property" );
                return height;
            }
            set
            {
                if ( height != value )
                    height = value;
            }
        }

        #endregion
    }
}
